import request from '@/utils/request'

export function query(data) {
  return request({
    url: `pp/p/schedule/query`,
    method: 'post',
    data
  })
}

export function save(data) {
  return request({
    url: `pp/p/schedule/save`,
    method: 'put',
    data
  })
}

export function remove(data) {
  return request({
    url: `pp/p/schedule/delete`,
    method: 'delete',
    data
  })
}

export function getById(id) {
  return request({
    url: `pp/p/schedule/getById/${id}`,
    method: 'get'
  })
}

export function getByIdWithCount(id) {
  return request({
    url: `pp/p/schedule/getByIdWithCount/${id}`,
    method: 'get'
  })
}

/**
 * 排程下达
 * @param data
 */
export function release(data) {
  return request({
    url: `pp/p/schedule/release?scheduleBo=${data}`,
    method: 'post'
  })
}
/**
 * 批量排程下达
 * @param data
 */
export function batchRelease(data) {
  return request({
    url: `pp/p/schedule/batchRelease`,
    method: 'post',
    data
  })
}

/**
 * 查询排程产线，保存数据后查询显示
 * @param data
 */
export function queryProductLine(data) {
  return request({
    url: `pp/p/schedule/scheduleProductionLineList`,
    method: 'post',
    data
  })
}
/**
 * 初始化查询排程产线，未保存数据后查询显示
 * @param data
 */
export function queryInitProductLine(data) {
  return request({
    url: `pp/p/schedule/initScheduleProductionLineList`,
    method: 'post',
    data
  })
}

/**
 * 根据产线bo获取工位信息
 * @param data
 */
export function queryStationByLine(data) {
  return request({
    url: `pp/p/schedule/getStationList?productionLineBo=${data}`,
    method: 'post'
  })
}

/**
 * 已下达，可投入装配的排程
 */
export function queryReleaseLine() {
  return request({
    url: `/pp/p/schedule/getByProductionLine`,
    method: 'get'
  })
}
